package com.aurora.source.home.activity;

import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;

import com.aurora.source.R;
import com.aurora.source.base.BasePresenter;
import com.aurora.source.base.BaseWhiteToolbarActivity;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author: ww
 * @description:
 * @date: 2018/10/12
 */
public class VideoPlayActivity extends BaseWhiteToolbarActivity {
    @BindView(R.id.vv_play)
    VideoView vvPlay;
    private String url;
    @Override
    public BasePresenter attach() {
        return null;
    }

    @Override
    public int bindLayout() {
        return R.layout.activity_video_view;
    }

    @Override
    public void initData(@Nullable Bundle bundle) {
        simpleToolbar.setMainTitle("视频浏览");
        simpleToolbar.setLeftVisibility(View.VISIBLE);
        url = getIntent().getStringExtra("url");
    }

    @Override
    public void initView(Bundle savedInstanceState, View contentView) {
      //  url = "https://s3m.mediav.com/galileo/13c7fc682a8060caba7e31e47d6112e4.mp4";
        Uri uri = Uri.parse(url);
        vvPlay.setMediaController(new MediaController(this));
        vvPlay.setVideoURI(uri);
        vvPlay.requestFocus();
        vvPlay.seekTo(1);

    }

    @Override
    public void doBusiness() {

    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
